package mws;

import java.util.ArrayList;
import java.util.List;

/**
 * Hello world!
 */
public class App {
    public static final ThreadLocal<List<String>> threadLocal = new ThreadLocal<>() {
        @Override
        protected List<String> initialValue() {
            return new ArrayList<>();
        }
    };

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }




    // 测试方法  try catch 这个 threadLocal
    public void testApp() {
        try {
            threadLocal.get().add("123");
            rpcServer();
            List<String> strings = threadLocal.get();
            String s = strings.get(strings.size() - 1);
            s += "complete";
            strings.add(s);
            threadLocal.set(strings);
        } finally {
            threadLocal.remove();
        }
    }


    public void rpcServer() {


    }

}
